package com.github.baichuan.application.scaffold.rest.domain.application;

import com.github.baichuan.mapping.EnumDescription;
import jakarta.persistence.*;
import lombok.Getter;
import lombok.Setter;

@Entity
@Setter
@Getter
public class Application {
    @Id
    private String id;

    @ManyToOne
    @JoinColumn(name = "realm_id")
    private Realm realm;

    private String name;

    private String code;

    @Enumerated(EnumType.STRING)
    private TenantMode tenant;

    private int passwordValidDays;

    private int passwordMaxFails;

    private int passwordLockMinutes;

    /**
     * 租户模式
     */
    public enum TenantMode {
        @EnumDescription("单租户")
        SINGLE,

        @EnumDescription("多租户")
        MULTIPLE
    }
}
